package br.com.cadele.beans;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.cadele.model.Avaliacao;
import br.com.cadele.service.AvaliacaoService;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

@ManagedBean(name="cadastrarAvaliacaoBean")
@URLBeanName(value="cadastrarAvaliacaoBean")
@ViewScoped
@URLMapping(id="cadastrarAvaliacaoBean", pattern="/avaliacao/cadastrar", viewId = "/pages/avaliacao/cadastrar.xhtml")
public class CadastrarAvaliacaoBean implements Serializable{

	private static final long serialVersionUID = -7876597997520364365L;
	private Avaliacao avaliacao;
	private AvaliacaoService avaliacaoService;

	@PostConstruct
	public void init(){
		avaliacao = new Avaliacao();
		avaliacaoService = new AvaliacaoService();
	}
	
	public void salvar() {
		avaliacaoService.executeInsert(avaliacao);
	}

	public Avaliacao getAvaliacao() {
		return avaliacao;
	}

	public void setAvaliacao(Avaliacao avaliacao) {
		this.avaliacao = avaliacao;
	}
}
